package cn.com.dhcc.fornew.pet.dao;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;
import cn.com.dhcc.app.core.base.BaseDao;
import cn.com.dhcc.app.core.component.db.orm.WhereCondition;
import cn.com.dhcc.app.core.component.pager.Pager;
import cn.com.dhcc.app.core.component.pager.PagerData;
import cn.com.dhcc.app.core.exception.DaoException;
import cn.com.dhcc.app.pub.core.CM;
import cn.com.dhcc.fornew.pet.vo.Dog;
import cn.com.dhcc.fornew.pet.vo.wapper.DogRowWapper;
/**
 * Dao
 * @日期：2017-6-1下午10:52:40
 * @作者： 杨贵隆
 */
@Repository
public class DogDao extends BaseDao {
	
	private static Logger logger = cn.com.dhcc.app.core.component.log.Log.getLogger("");
	/**
	 * 列表
	 */
	public PagerData<Dog> list(Pager pager, WhereCondition condition)
			throws DaoException {
		String msg = "";
		String sql = "select * from " + WSD_TABLE("t_dog");
		try {
			return CM.getDao().getPagerList("获取分页信息列表", sql,
					new DogRowWapper(), pager, condition, new Object[] {});
		} catch (DaoException e) {
			msg = "获取分页信息列表失败";
			logger.error("获取分页信息列表失败", e);         
			throw new DaoException(msg, e);  
		}
	}
	
	/**
     * 获取对象
     *
     */
    public Dog get(String id) throws DaoException {
        return getDao().getModuleById("获取对象",Dog.class,new Object[]{id});
    }
    
    /**
     * 新增
     *
     */
    public int insert(Dog obj) throws DaoException {
        return getDao().insertModule("新增",obj);
    }
	
    /**
     * 修改
     * 
     */
    public int update(Dog obj) throws DaoException {
        return getDao().updateModuleByIdExecuteNull("修改",obj);
    }
    
    
    

}
